import request from "@/network/require";

/*获取歌单数据*/
function getPlaylistTrackAll(id: string, cookie?: string, offset = 0, limit = 20) {
    return request({
        url: "/playlist/track/all",
        params: {
            id: id,
            limit: limit,
            offset: offset,
            cookie: cookie
        }
    });
}

/*获取歌单评论*/
function getPlaylistComment(id: string, offset = 0, before: string, cookie?: string, limit = 20) {
    return request({
        url: "/comment/playlist",
        params: {
            id: id,
            limit: limit,
            offset: offset,
            cookie: cookie,
            before: before
        }
    });
}

//获取音乐 url
function getSongUrl(id: string, cookie?: string, br?: string) {
    return request({
        url: "/song/url",
        params: {
            id: id,
            cookie: cookie,
            br: br
        }
    });
}

//获取歌曲详情
function getSongDetail(ids: string, cookie?: string) {
    return request({
        url: "/song/detail",
        params: {
            ids: ids,
        }
    });
}

//用户登陆后获取用户每日推荐歌曲
function getRecommendedSongsOfTheDay(cookie: string) {
    return request({
        url: "/recommend/songs",
        params: {
            cookie: cookie
        }
    })
}

//用户登陆后获取用户每日推荐歌单
function getRecommendedListOfTheDay(cookie: string) {
    return request({
        url: "/recommend/resource",
        params: {
            cookie: cookie,
        }
    })
}

export {
    getPlaylistTrackAll,
    getPlaylistComment,
    getSongUrl,
    getSongDetail,
    getRecommendedSongsOfTheDay,
    getRecommendedListOfTheDay
};
